package com.yymx.toback.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;


@Getter
@AllArgsConstructor
public enum CodeEnum {

    //状态
    STATUS_SUCCESS("200","处理成功"),
    STATUS_FAIL("500","处理失败"),

    //访问
    PERMISSION_SUCCESS("20000","权限通过"),
    PERMISSION_FAIL("20001","没有该访问权限"),
    TOKEN_EMPTY("20002","token不能为空"),
    TOKEN_ERROR("20003","token错误"),


    //账户
    ACCOUNT_NOT_EXIST("30000","账户不存在"),
    ACCOUNT_EXIST("30001","账户已存在"),
    ACCOUNT_ERROR("30002","账户错误"),
    ACCOUNT_NOT_LOGIN("30004","请先登录"),
    ACCOUNT_SUCCESS("30005","登录成功"),
    AUTHENTICATION_ERROR("30006","登录失败"),
    AUTHENTICATION_FAIL("30007","授权码错误"),
    REPEAT_AUTHENTICATION__ERROR("30008","请勿重复认证"),
    PASSWORD_FAIL("30009","请先设置密码"),
    ACTIVITY_REGISTER_EXIST("30010","您已经助力过啦"),


    REQUEST_SUCCESS("200","处理成功"),
    SERVICE_FAIL("500","未知错误"),
    URL_FAIL("404","接口不存在"),
    SING_FAIL("401","数字签名错误"),
    ACCOUNT_PASSWORD_ERROR("402","账号或者密码错误"),
    TOKEN_FAIL("403","授权码错误"),
    TOKEN_EXPIRED("405","授权码过期,请重新登录"),
    TOKEN_REFRESH("406","授权码刷新"),
    UID_FAIL("407","uid错误"),

    NO_PERMISSON("4003","没有权限"),

    USER_STATUS_NORMAL("40000","0"),
    USER_STATUS_FREEZE("40001","1"),
    USER_REAL_STATUS_INIT("40002","0"),
    USER_REAL_STATUS_SUCCESS("40003","1"),

    ERROR_REQUEST_METHOD("50000","请求方式错误");



    private String code;
    private String top;

    public static CodeEnum getType(Integer type) {
        CodeEnum[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            CodeEnum item = var1[var3];
            if (item.getTop().equals(type)) {
                return item;
            }
        }

        return null;
    }




}
